<?php
namespace App\Modules\Admin\Controllers;

use App\Http\Resources\Admin\DictTypeResource;
use App\Modules\Admin\Services\DictTypeService;
use Illuminate\Http\Request;


class DictTypeController extends AdminController
{
    public function index(Request $request, DictTypeService $service)
    {
        $dictTypes = DictTypeResource::collection($service->page($request->all()));

        return $this->responseSuccess([
            'list' => $dictTypes,
            'total' => $dictTypes->total()
        ]);
    }

    public function add(Request $request, DictTypeService $service)
    {
        return $this->responseSuccess($service->add($request->all()));
    }

    public function edit(Request $request, Int $id, DictTypeService $service)
    {
        return $this->responseSuccess($service->edit($id, $request->all()));
    }

    public function detail(Int $id, DictTypeService $service)
    {
        return $this->responseSuccess($service->detail($id));
    }

    public function del(Int|String $id, DictTypeService $service)
    {
        return $this->responseSuccess($service->del($id));
    }
}